/*Set-Up */
#delimit;
pause on;
clear;
pause;
set mem 15m;
pause;
set more off;
pause;
cd "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Split";
pause;
log using July07, replace;
pause;
use Gerry_2, clear;
pause;
save "Gerry0921",replace;
pause;

/*Label Key Variables*/

/*Gerrymandering*/
lab var split "Province Split (1 or 0)";

lab var previoussplit "Province the result of previous split (1 or 0)";

lab var sixty_five "Province already at 1965 borders"; 

lab var Tonkin "Part of former Tonkin Region";     

generate Annam=0;
replace Annam=1 if region==3|region==4|region==5;
replace Annam= 1 if province_code==11| province_code==41|province_code==108;

generate Cochin=0;
replace Cochin=1 if Annam==0 & Tonkin==0;

generate French=1;
replace French=2 if Annam==1;
replace French=3 if Cochin==1;



lab var  South "Southern Dummy";

lab var city_dum "City Dummy";

lab var pop_10000 "Population in 10000s";

lab var area "Area (thousands of square kilometers)";

lab var border "International Border";

lab var minority "% of Minorities in Province";

lab var soe_per "SOE share of provincial industrial output";

lab var cabinet "Number of Compatriots in Cabinet";

generate state_cabinet=soe_per*cabinet;

lab var state_cabinet "Interaction between  SOE share and Cabinet members";

generate cabinet3 = cabinet;
replace cabinet3 = 2 if cabinet>=2;

lab var  cabinet3 "Cabinet (0, 1, 2+)";

generate state_cabinet3=soe_per*cabinet3;

lab var  state_cabinet3 "Interaction between  SOE share and Cabinet (0, 1, 2+)";

generate city_dum2=city_dum;

replace city_dum2=1 if province_code==15|province_code==62 ;

lab var city_dum2 "National Level City";

lab var gdp_cap "GDP per Capita";
pause;

generate ln_gdpcap=ln(gdp_cap);

lab var ln_gdpcap "Natural Log of GDP per Capita";
pause;

generate soe_high=1 if soe_per>50;
replace soe_high = 0 if soe_per<=50;
pause;

generate soe_high49=1 if soe_per>=49;
replace soe_high49 = 0 if soe_per<49;
pause;

generate state_sq=soe_per^2;
pause;

replace urban_per = 16.35 if province_code==120;
replace urban_per = 7.15 if province_code==101;
pause;




generate time=16-(2005-year);
replace time=. if year>2004;

replace time=time-1 if province_code==8;
replace time=time-1 if province_code==30;
replace time=time-1 if province_code==43;
replace time=time-1 if province_code==44;
replace time=time-1 if province_code==48;
replace time=time-1 if province_code==57;


replace time=time-3 if province_code==11;
replace time=time-3 if province_code==13;
replace time=time-3 if province_code==19;
replace time=time-3 if province_code==20;
replace time=time-3 if province_code==23;
replace time=time-3 if province_code==24;
replace time=time-3 if province_code==28;
replace time=time-3 if province_code==32;
replace time=time-3 if province_code==36;
replace time=time-3 if province_code==39;
replace time=time-3 if province_code==40;
replace time=time-3 if province_code==41;
replace time=time-3 if province_code==49;
replace time=time-3 if province_code==56;
replace time=time-3 if province_code==58;
replace time=time-3 if province_code==59;
replace time=time-3 if province_code==61;
replace time=time-3 if province_code==106;


replace time=time-7 if province_code==3;
replace time=time-7 if province_code==4;
replace time=time-7 if province_code==5;
replace time=time-7 if province_code==15;
replace time=time-7 if province_code==21;
replace time=time-7 if province_code==25;
replace time=time-7 if province_code==29;
replace time=time-7 if province_code==38;
replace time=time-7 if province_code==42;
replace time=time-7 if province_code==45;
replace time=time-7 if province_code==53;
replace time=time-7 if province_code==60;


replace time=time-14 if province_code==62;
replace time=time-14 if province_code==63;
replace time=time-14 if province_code==64;
replace time=time-14 if province_code==65;
replace time=time-14 if province_code==66;
replace time=time-14 if province_code==67;

by province_code, sort: sum year;


generate SOE3=1;
lab var SOE3 "Provincial Voting Bloc in CCOM";
replace SOE3=2 if soe_per>31.07 & soe_per<65.37;
replace SOE3=3 if soe_per>=65.37;
pause;

list province province_code soe_per SOE3 if year==1991;
pause;
list province province_code soe_per SOE3 if year==1996;
pause;
list province province_code soe_per SOE3 if year==2001;
pause;
list province province_code soe_per SOE3 if year==2001;
pause;

generate CCOM=0;
lab var CCOM "Number of Central Committee Members";

/*After 1991 Congress*/
replace CCOM=2 if province_code==1 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==7 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==8 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==14 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==16 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==17 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==18 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==22 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==26 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==27 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==30 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==31 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==33 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==35 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==37 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==43 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==44 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==46 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==47 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==48 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==50 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==51 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==52 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==54 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==55 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==57 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==101 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==102 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==103 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==104 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==105 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==107 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==109 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==110 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==111 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==112 & year>=1992 & year<=1996;
replace CCOM=2 if province_code==113 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==114 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==115 & year>=1992 & year<=1996;
replace CCOM=0 if province_code==116 & year>=1992 & year<=1996;
replace CCOM=1 if province_code==117 & year>=1992 & year<=1996;


/*After 1996 Congress*/
replace CCOM=1 if province_code==1 & year>=1997 & year<2001;
replace CCOM=2 if province_code==2 & year>=1997 & year<2001;
replace CCOM=0 if province_code==7 & year>=1997 & year<2001;
replace CCOM=1 if province_code==8 & year>=1997 & year<2001;
replace CCOM=1 if province_code==11 & year>=1997 & year<2001;
replace CCOM=1 if province_code==13 & year>=1997 & year<2001;
replace CCOM=1 if province_code==14 & year>=1997 & year<2001;
replace CCOM=1 if province_code==16 & year>=1997 & year<2001;
replace CCOM=1 if province_code==17 & year>=1997 & year<2001;
replace CCOM=1 if province_code==18 & year>=1997 & year<2001;
replace CCOM=1 if province_code==19 & year>=1997 & year<2001;
replace CCOM=1 if province_code==20 & year>=1997 & year<2001;
replace CCOM=4 if province_code==22 & year>=1997 & year<2001;
replace CCOM=1 if province_code==23 & year>=1997 & year<2001;
replace CCOM=0 if province_code==24 & year>=1997 & year<2001;
replace CCOM=1 if province_code==26 & year>=1997 & year<2001;
replace CCOM=2 if province_code==27 & year>=1997 & year<2001;
replace CCOM=1 if province_code==28 & year>=1997 & year<2001;
replace CCOM=1 if province_code==30 & year>=1997 & year<2001;
replace CCOM=1 if province_code==31 & year>=1997 & year<2001;
replace CCOM=1 if province_code==32 & year>=1997 & year<2001;
replace CCOM=1 if province_code==33 & year>=1997 & year<2001;
replace CCOM=1 if province_code==34 & year>=1997 & year<2001;
replace CCOM=1 if province_code==35 & year>=1997 & year<2001;
replace CCOM=1 if province_code==36 & year>=1997 & year<2001;
replace CCOM=1 if province_code==37 & year>=1997 & year<2001;
replace CCOM=1 if province_code==39 & year>=1997 & year<2001;
replace CCOM=1 if province_code==40 & year>=1997 & year<2001;
replace CCOM=1 if province_code==41 & year>=1997 & year<2001;
replace CCOM=1 if province_code==43 & year>=1997 & year<2001;
replace CCOM=1 if province_code==44 & year>=1997 & year<2001;
replace CCOM=1 if province_code==46 & year>=1997 & year<2001;
replace CCOM=1 if province_code==47 & year>=1997 & year<2001;
replace CCOM=1 if province_code==48 & year>=1997 & year<2001;
replace CCOM=1 if province_code==49 & year>=1997 & year<2001;
replace CCOM=2 if province_code==50 & year>=1997 & year<2001;
replace CCOM=1 if province_code==57 & year>=1997 & year<2001;
replace CCOM=2 if province_code==51 & year>=1997 & year<2001;
replace CCOM=1 if province_code==52 & year>=1997 & year<2001;
replace CCOM=1 if province_code==54 & year>=1997 & year<2001;
replace CCOM=1 if province_code==55 & year>=1997 & year<2001;
replace CCOM=1 if province_code==56 & year>=1997 & year<2001;
replace CCOM=1 if province_code==58 & year>=1997 & year<2001;
replace CCOM=1 if province_code==59 & year>=1997 & year<2001;
replace CCOM=1 if province_code==61 & year>=1997 & year<2001;
replace CCOM=2 if province_code==106 & year>=1997 & year<2001;
replace CCOM=1 if province_code==111 & year>=1997 & year<2001;
replace CCOM=1 if province_code==112 & year>=1997 & year<2001;
replace CCOM=1 if province_code==113 & year>=1997 & year<2001;
replace CCOM=1 if province_code==114 & year>=1997 & year<2001;
replace CCOM=2 if province_code==115 & year>=1997 & year<2001;
replace CCOM=1 if province_code==116 & year>=1997 & year<2001;
replace CCOM=1 if province_code==117 & year>=1997 & year<2001;
pause;


/*After 2001 Congress*/
replace CCOM=1 if year>=2001 & year<=2006;
replace CCOM=0 if province_code==24 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==34 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==43 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==58 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==60 & year>=2002 & year<=2006;
replace CCOM=3 if province_code==27 & year>=2002 & year<=2006;
replace CCOM=3 if province_code==22 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==64 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==65 & year>=2002 & year<=2006;
replace CCOM=0 if province_code==66 & year>=2002 & year<=2006;
replace CCOM=2 if province_code==50 & year>=2002 & year<=2006;
replace CCOM=2 if province_code==56 & year>=2002 & year<=2006;
pause;



/*After 2006 Congress*/
replace CCOM=1 if year>=2006;
replace CCOM=1.5 if province_code==13 & year>=2006;
replace CCOM=1.5 if province_code==31 & year>=2006;
replace CCOM=1.5 if province_code==36 & year>=2006;
replace CCOM=1.5 if province_code==44 & year>=2006;
replace CCOM=1.5 if province_code==1 & year>=2006;
replace CCOM=1.5 if province_code==2 & year>=2006;
replace CCOM=1.5 if province_code==5 & year>=2006;
replace CCOM=5 if province_code==27 & year>=2006;
replace CCOM=1.5 if province_code==20 & year>=2006;
replace CCOM=3 if province_code==22 & year>=2006;
replace CCOM=1.5 if province_code==24 & year>=2006;
replace CCOM=1.5 if province_code==37 & year>=2006;
replace CCOM=1.5 if province_code==51 & year>=2006;
pause;

by SOE3, sort : tabstat CCOM, statistic(sum)  by(year) columns(variables);
pause;

generate CCOM2=CCOM;
replace CCOM2 = 1 if CCOM==1.5;
pause;

by SOE3, sort : tabstat CCOM2, statistic(sum)  by(year) columns(variables);
pause;

/*Poliburo*/
pause;

generate politburo=0;

replace politburo=0 if year ==1990 & province_code==110;
replace politburo= 0 if year==1990 & province_code==22;
replace politburo=1 if year==1991 & province_code==117;
replace politburo=1 if year >=1991 & year<=1995 & province_code==22;
replace politburo=2 if year >=1991 & year<=1995 & province_code==22;
replace politburo=1 if year >=1991 & year<=1995 & province_code==27;


replace politburo=3 if year >=1996 & year<=1997 & province_code==22;
replace politburo=2 if year >=1997 & year<=2001 & province_code==22;
replace politburo=1 if year >=1996 & year<=2001 & province_code==54;
replace politburo=1 if year >=1996 & year<=2001 & province_code==59;
replace politburo=2 if year >=1996 & year<=2001 & province_code==27;

replace politburo=1 if year >=1997 & year<=2006 & province_code==53;
replace politburo=1 if year >=1991 & year<=2006 & province_code==39;
replace politburo=1 if year >=2001 & year<=2006 & province_code==27;
replace politburo=1 if year >=2001 & year<=2006 & province_code==27;
replace politburo=1 if year >=1996 & year<=2006 & province_code==46;
replace politburo=1 if year >=2001 & year<=2006 & province_code==22;
replace politburo=1 if year >=2001 & year<=2006 & province_code==15;
replace politburo=1 if year >=2001 & year<=2006 & province_code==12;

replace politburo=1 if year >=2001 & year<=2006 & province_code==12;
replace politburo=1 if year >=2001 & year<=2006 & province_code==9;
replace politburo=1 if year >=1997 & year<=2006 & province_code==31;
replace politburo=1 if year >=1997 & year<=2006 & province_code==6;
replace politburo=1 if year ==1996 & province_code==6;



/*Straight Ahead*/

lab var fdistock_gdp "Stock of FDI/GDP";


lab var distance_hcmchn "Distance from major market";   


lab var caseofautonomy "Case of Fence-Breaking";

/*Create New Dummy using low HCMC, so HCMC does not perfectly predict Autonomy*/

generate  caseofautonomy2= caseofautonomy;

replace  caseofautonomy2= 0 if province_code==27 & year==1994;

lab var caseofautonomy2 "Case of Fence-Breaking";

lab var years_congress "Years Since Party Congress";

generate exports_cap=exports/pop_10000;



/*Creation of Infrastructure Minimum*/
factor  urban_per tel_1000 road_transport, pcf;

predict infrastructure, regress;

by province_code, sort : egen float infra_min = min(infrastructure);

lab var infra_min "Infrastructure (Year 1)";

list province infra_min if year==1997;
pause;

/*Set as Cross-Sectional Time Series Data*/
tsset province_code year;
pause;


generate lag_congress=0;
replace lag_congress=1 if year==1992 | year==1997| year==2002;
pause;

/*STSET*/
pause;

stset time, failure(split) id(province_code);

pause;

stcox sixty_five lag_congress  area_1000  South border pop_10000 ln_gdpcap soe_high49 urban_per minority cabinet, robust cluster(province_code) schoenfeld(sch_f*) scaledsch(sca_f*);
outreg2 using stcox, eform e(all) replace;
pause;

stphtest, detail;
pause;

stphplot,  by(soe_high49) lpattern (l "__")lwidth(thick thin)  legend( rows(2) label (  1 SOE Share of Industrial Output below 50%) label ( 2 SOE Share of Industrial Output above 50%));
graph save "C:\data\Split\survival", replace;
pause;

stcoxkm, by(soe_high49);
pause;

graph save "C:\data\Split\coxkm.gph", replace;
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap, robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap   , tvc(ln_gdpcap  ) texp(ln(_t)) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49  , tvc( ln_gdpcap soe_high49  ) texp(ln(_t)) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49  , tvc( ln_gdpcap soe_high49  ) texp(ln(_t)<1.6) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49  , tvc( ln_gdpcap soe_high49  ) texp(ln(_t)>1.6) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49 urban_per minority cabinet, tvc( ln_gdpcap soe_high49 minority cabinet  ) texp(ln(_t)) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;


sts test  soe_high49, logrank;
sts test  soe_high49 if ln(_t)>1.6, logrank;
sts test  sixty_five, logrank;
sts test  lag_congress, logrank;
sts test  South, logrank;
sts test  border, logrank;
sts test  cabinet, logrank;
sts test  pcom_rel, logrank;
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49 urban_per minority cabinet, tvc( ln_gdpcap soe_high49 minority cabinet  ) texp(ln(_t)<1.6) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

sts test  soe_high49, logrank;
sts test  soe_high49 if ln(_t)>1.6, logrank;
sts test  sixty_five, logrank;
sts test  lag_congress, logrank;
sts test  South, logrank;
sts test  border, logrank;
sts test  cabinet, logrank;
sts test  pcom_rel, logrank;
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49 urban_per minority cabinet, tvc( ln_gdpcap  soe_high49 minority cabinet  ) texp(ln(_t)>1.6) robust cluster(province_code);
outreg2 using stcox, eform e(all);
pause;

sts test  soe_high49, logrank;
sts test  soe_high49 if ln(_t)>1.6, logrank;
sts test  sixty_five, logrank;
sts test  lag_congress, logrank;
sts test  South, logrank;
sts test  border, logrank;
sts test  cabinet, logrank;
sts test  pcom_rel, logrank;
pause;

/*Robust to People's Committee Rank*/
stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49 urban_per minority cabinet pcom_rel, tvc( ln_gdpcap  soe_high49 minority cabinet  ) texp(ln(_t)>1.6) robust cluster(province_code);
outreg2 using stcox, eform e(all);


/*Robust to Dropping National Cities*/
pause;

stcox sixty_five  area_1000 lag_congress South border pop_10000 ln_gdpcap soe_high49 urban_per minority cabinet pcom_rel if city_dum2==0 , tvc( ln_gdpcap  soe_high49 minority cabinet  ) texp(ln(_t)>1.6) robust cluster(province_code);
outreg2 using stcox, eform e(all) label excel;
pause;

sts graph, cihazard hazard  by(soe_high49)  lpattern ("l" " ." " .") lwidth(thick thick thick)  
lcolor (navy) ytitle("Kaplan-Meier Hazard Ratios") xtitle("Analysis Time") pstyle(ci) subtitle(SOE share <50%) subtitle (SOE share >50%);


graph save "C:\data\Split\coxkm.gph", replace;
pause;


/*Probit*/


reg split previoussplit sixty_five   pop_1000 area_1000 border soe_per  cabinet minority ln_gdpcap urban_per lag_congress South, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse) replace;



reg split previoussplit sixty_five   pop_1000 area_1000 border soe_high49  cabinet minority ln_gdpcap urban_per lag_congress South, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five   pop_1000 area_1000 border soe_per  cabinet minority ln_gdpcap urban_per South if year==1990| year==1992| year==1996|year==2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five   pop_1000 area_1000 border soe_high49  cabinet minority ln_gdpcap urban_per South if year==1990| year==1992| year==1996|year==2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap  if year==1990, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap   if year==1992, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap   if year==1996, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap   if year==2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap South border cabinet minority urban_per  if year==1990, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap South border cabinet minority urban_per  if year==1992, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);


reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap South border cabinet minority urban_per  if year==1996, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);



reg split previoussplit sixty_five  pop_1000 area_1000 soe_per ln_gdpcap South border cabinet minority urban_per  if year==2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

reg split previoussplit sixty_five  pop_1000 area_1000 ln_gdpcap South border cabinet minority urban_per  if year==1990, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_1990a if year==1990;
sum pre_split_1990a;
pause;
generate pre_split_1990a_dich = 0 if pre_split_1990a <.5 & year==1990;
replace pre_split_1990a_dich = 1 if pre_split_1990a >=.5 & year==1990;
tab split pre_split_1990a_dich, row;
pause;


reg split previoussplit sixty_five  pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet minority urban_per  if year==1990, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_1990 if year==1990;
sum pre_split_1990;
pause;
generate pre_split_1990_dich = 0 if pre_split_1990 <.5 & year==1990;
replace pre_split_1990_dich = 1 if pre_split_1990 >=.5 & year==1990;
tab split pre_split_1990_dich, row;
pause;

reg split previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==1992, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_1991a if year==1992;
sum pre_split_1991a;
pause;
generate pre_split_1991a_dich = 0 if pre_split_1991a <.5 & year==1992;
replace pre_split_1991a_dich = 1 if pre_split_1991a >=.5 & year==1992;
tab split pre_split_1991a_dich, row;
pause;

reg split previoussplit sixty_five  pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet minority urban_per  if year==1992, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_1991 if year==1992;
sum pre_split_1991;
pause;
generate pre_split_1991_dich = 0 if pre_split_1991 <.5 & year==1992;
replace pre_split_1991_dich = 1 if pre_split_1991 >=.5 & year==1992;
tab split pre_split_1991_dich, row;
pause;

reg split previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==1996, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_1996a if year==1996;
sum pre_split_1996a;
pause;
generate pre_split_1996a_dich = 0 if pre_split_1996a <.5 & year==1996;
replace pre_split_1996a_dich = 1 if pre_split_1996a >=.5 & year==1996;
tab split pre_split_1996a_dich, row;
pause;

reg split previoussplit sixty_five  pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet minority urban_per  if year==1996, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_1996 if year==1996;
sum pre_split_1996;
pause;
generate pre_split_1996_dich = 0 if pre_split_1996 <.5 & year==1996;
replace pre_split_1996_dich = 1 if pre_split_1996 >=.5 & year==1996;
tab split pre_split_1996_dich, row;
pause;

reg split previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_2003a if year==2003;
sum pre_split_2003a;
pause;
generate pre_split_2003a_dich = 0 if pre_split_2003a <.5 & year==2003;
replace pre_split_2003a_dich = 1 if pre_split_2003a >=.5 & year==2003;
tab split pre_split_2003a_dich, row;
pause;


reg split previoussplit sixty_five  pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet minority urban_per  if year==2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);

predict pre_split_2003 if year==2003;
sum pre_split_2003;
pause;
generate pre_split_2003_dich = 0 if pre_split_2003 <.5 & year==2003;
replace pre_split_2003_dich = 1 if pre_split_2003 >=.5 & year==2003;
tab split pre_split_2003_dich, row;
pause;

tab split pre_split_1990a_dich, row;
tab split pre_split_1990_dich, row;
tab split pre_split_1991a_dich, row;
tab split pre_split_1991_dich, row;
tab split pre_split_1996_dich, row;
tab split pre_split_1996a_dich, row;
tab split pre_split_2003_dich, row;
tab split pre_split_2003_dich, row;
pause;


foreach num of numlist 1990, 1992, 1996, 2003 {;
generate year_`num' =1  if  year==`num';
replace year_`num' =0  if  year !=`num';
generate inter_SOE_`num'=year_`num'*soe_high49;
};

reg split previous  sixty_five pop_1000 area_1000 soe_high49 ln_gdpcap lag_congress  South border cabinet minority urban_per
year_1990 year_1992  year_1996  year_2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);
pause;

reg split previous  sixty_five pop_1000 area_1000 soe_high49 ln_gdpcap lag_congress  South border cabinet minority urban_per
year_1990 inter_SOE_1990 year_1992 inter_SOE_1992 year_1996 inter_SOE_1996 year_2003 inter_SOE_2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);
pause;

reg split previous  sixty_five pop_1000 area_1000 soe_high49 ln_gdpcap lag_congress  South border cabinet minority urban_per
year_1990 inter_SOE_1990 year_1992 inter_SOE_1992 year_1996 inter_SOE_1996 year_2003 inter_SOE_2003 if city_dum==0, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);
pause;

/*Drop HCMC*/

generate HCMC=1 if province_code==27;
replace HCMC=0 if province_code !=27;

reg split previous  sixty_five pop_1000 area_1000 soe_high49 ln_gdpcap lag_congress  South border cabinet minority urban_per
year_1990 inter_SOE_1990 year_1992 inter_SOE_1992 year_1996 inter_SOE_1996 year_2003 inter_SOE_2003 if HCMC==0, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);
pause;

/*Treat HCMC as an Reformist Province*/

generate soe_plus=soe_high49;
replace soe_plus =0 if HCMC==1;

foreach num of numlist 1990, 1992, 1996, 2003 {;
generate inter_SOEplus_`num'=year_`num'*soe_plus;
};

reg split previous  sixty_five pop_1000 area_1000 soe_plus ln_gdpcap lag_congress  South border cabinet minority urban_per 
year_1990 inter_SOEplus_1990 year_1992 inter_SOEplus_1992 year_1996 inter_SOEplus_1996 year_2003 inter_SOEplus_2003, robust;
outreg2 using "C:\data\Split\reg_year", e(rmse);
pause;

reg split previous  sixty_five pop_1000 area_1000 soe_high49 ln_gdpcap lag_congress  South border cabinet minority urban_per
year_1990 inter_SOE_1990 year_1992 inter_SOE_1992 year_1996 inter_SOE_1996 year_2003 inter_SOE_2003 pcom_rel, robust;
outreg2 using "C:\data\Split\reg_year",  e(rmse) label excel; 
pause;


/*HCMC Confirm*/
reg split soe_high49  previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==1990 & HCMC==0, robust;
outreg2 using "C:\data\Split\HCMC",  e(rmse) replace; 
reg split soe_high49 previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==1992 & HCMC==0, robust;
outreg2 using "C:\data\Split\HCMC",  e(rmse) ;
reg split soe_high49  previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==1996 & HCMC==0, robust;
outreg2 using "C:\data\Split\HCMC",  e(rmse) ;
reg split soe_high49  previoussplit sixty_five  pop_1000 area_1000  ln_gdpcap South border cabinet minority urban_per  if year==2003 & HCMC==0, robust;
outreg2 using "C:\data\Split\HCMC",  e(rmse) label excel;





generate year3=year if year==1990;
replace year3=1991 if year==1992;
replace year3=year if year==1996;
replace year3=year if year==2003;


probit split previoussplit sixty_five   pop_1000 area_1000 border soe_high49  cabinet minority ln_gdpcap urban_per South, robust;
outreg2 using "C:\data\Split\dprobit", ci e(all) replace;

probit split previoussplit sixty_five   pop_1000 area_1000 border soe_high49  cabinet minority ln_gdpcap urban_per South if year==1990| year==1992| year==1996|year==2003, robust;
outreg2 using "C:\data\Split\dprobit", ci e(all);

probit split pop_1000 area_1000 soe_high49 ln_gdpcap South border if year==1990, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

dprobit split pop_1000 area_1000 soe_high49 ln_gdpcap South border if year==1990, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

probit split   pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet urban_per  if year==1992, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

dprobit split   pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet urban_per  if year==1992, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

probit split   pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet urban_per  if year==1996, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

dprobit split   pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet urban_per  if year==1996, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

probit split   pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet urban_per  if year==2003, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

dprobit split   pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet urban_per  if year==2003, robust;
outreg2 using "C:\data\Split\dprobit",  e(all);

xi3: dprobit split  previous sixty_five pop_1000 area_1000 soe_high49 ln_gdpcap South border cabinet minority urban_per i.year if year3 !=., robust asis;

probit split previoussplit sixty_five   pop_1000 area_1000 border soe_high49  cabinet minority ln_gdpcap urban_per South year_1990 year_1992 year_1996
year_2003,  robust asis;
outreg2 using "C:\data\Split\dprobit",  e(all);
pause;

probit split previoussplit sixty_five   pop_1000 area_1000 border soe_high49  cabinet minority ln_gdpcap urban_per South 
year_1990 inter_SOE_1990 year_1992 inter_SOE_1992 year_1996 inter_SOE_1996 year_2003 inter_SOE_2003,  robust asis ;
outreg2 using "C:\data\Split\dprobit",  e(all) label excel;
pause;

xi3: probit split  previous sixty_five pop_1000 area_1000 soe_high49  ln_gdpcap South border cabinet minority urban_per i.year if year3 !=., robust asis;


xi3: dprobit split  previous sixty_five pop_1000 area_1000 i.soe_high49*i.year ln_gdpcap South border cabinet minority urban_per if year3 !=., robust asis;


xi3: probit split  previous sixty_five pop_1000 area_1000 i.soe_high49*i.year ln_gdpcap South border cabinet minority urban_per if year3 !=., robust asis;


postgr3 year, by(soe_high49) table x(previoussplit 0 sixty_five 0);
pause;

xi3: dprobit split  previous sixty_five pop_1000 area_1000 i.soe_high49*i.year ln_gdpcap South border cabinet minority urban_per if year3 !=. & city_dum2==0, robust asis;

xi3: dprobit split  previous sixty_five pop_1000 area_1000 i.soe_high49*i.year ln_gdpcap South border cabinet minority urban_per pcom_rel if year3 !=., robust asis;


save "Gerry0707",replace;


sort province_code;
pause;


merge province_code using PCI;
pause;

generate pos_rev=1 if diff_rev>=0;
replace pos_rev=0 if diff_rev<0;

tab pos_rev;
pause;

drop _merge;

sort province_code year;

merge province_code year using province2004, keep ( lsoes2000 lsoes2004 changeinlsoessince2000 lsoe_liab lsoe_employ LSOE_loans cases_per cases_cap vocation_cap LURC_prov wait_effect land_available  no_ent ln_ent1000 telcap_95 
freight_95 retail_95  pop_95 distance_hnhcmc  highschool highschool_un  avgann_profent avgann_invcap ln_avganninvcap avgann_revinv);

pause;

drop _merge;

/*Dummy Variable*/

xi3: reg  attitude pos_rev tel_1000   South pop_1 urban_per distance_hcmc secondary  if year==2004, robust;
outreg2 using "C:\data\Split\attitudeDUM", replace;

xi3: reg obstacle pos_rev tel_1000   South pop_1  urban_per distance_hcmc secondary   if year==2004, robust;
outreg2 using "C:\data\Split\attitudeDUM";

xi3: reg   LURC_prov pos_rev tel_1000  South pop_1  urban_per distance_hcmc secondary  if year==2004, robust;
outreg2 using "C:\data\Split\attitudeDUM";

xi3: reg   wait_effect pos_rev tel_1000   South pop_1  urban_per distance_hcmc secondary   if year==2004, robust;
outreg2 using "C:\data\Split\attitudeDUM";

xi3: reg    avgann_profent pos_rev tel_1000   South pop_1  urban_per distance_hcmc secondary   if year==2004, robust;
outreg2 using "C:\data\Split\attitudeDUM", label excel;



/*State Investment*/

xtset province_code year;
merge province_code year using soe_census, keep( inv_);
drop _merge;
xtset province_code year;
merge province_code year using budget;


generate stateinv_gdp00=inv_/(gdp*100);
generate stateinv_gdp_new=stateinv_gdp;
replace stateinv_gdp_new=stateinv_gdp00 if year>=2000;
replace stateinv_gdp_new=stateinv_gdp_new*10;
generate ln_stateinv_cap= ln(((stateinv_gdp_new*gdp*100)/pop_1)+1);

generate ln_nat_transfer_cap=ln((nat_transfers/pop_1)+1);

generate cabinet_dum=1 if cabinet>0;
replace cabinet_dum=0 if cabinet==0;
generate ln_stateinv=ln(stateinv_cap+1);
generate transfer_pop= transfers04/pop_10000;
generate ln_transfers=ln( transfer_pop+1);
generate years_sq=years_c^2;

xtset province_code year;
by province_code, sort: egen total_split=sum(previous);
generate lag_split=0;
replace lag_split=1 if year==1990 & total_split==17;
replace lag_split=1 if year==1991 & total_split==16;
replace lag_split=1 if year==1993 & total_split==14;
replace lag_split=1 if year==1997 & total_split==10;
replace lag_split=1 if year==2004 & total_split==3;
pause;

xtset province_code year;

drop _merge;
xtset province_code year;
merge province_code year using salary, keep(salary_gov2);

replace salary_gov=salary_gov2 if year>=2002;
replace salary_gov=(salary_gov+salary_gov2)/2 if year >1999 & year <2002;

generate  ln_total_transfers_cap=ln(([nat_transfers+nat_programs]/pop_1)+1);

drop _merge;
xtset province_code year;
merge province_code year using n_officials , keep(officials);

xtset province_code year;
generate change_officials=(d.officials/l.officials)*100;

twoway (qfit nat_programs years_c) (qfit nat_transfers years_c), ytitle(Millions of Vietnamese Dong)  ylabel(, labsize(small))  legend( rows(2) label (1 Transfers to Provinces for Targeted National Programs(Education, Health, Infrastructure)) label (2 Supplementary Budget Transfers to Provinces to Cover Budget Shotrfalls) size(small));

rename previous prev;
generate deficit=total_budget-loc_revenue;
generate deficit_ratio=deficit/loc_revenue;
generate pol=politburo;
replace pol=1 if politburo>=1;
generate prev97=prev if province_code==3|province_code==4|province_code==5|province_code==6|province_code==9|province_code==10|province_code==12|province_code==15|province_code==21|province_code==25|province_code==29|province_code==38|province_code==42|province_code==45|province_code==53|province_code==60;
replace prev97=0 if prev97==. & prev !=.;





xi3: xtpcse d.ln_nat_transfer_cap i.prev97*pol soe_high49  d.secondary d.tel_1 d.gdp_cap d.urban_per distance_hcmchn  area_1 city brvt, correlation(psar1) hetonly;
outreg2 using "C:\data\Split\trans_Jan08", e(rsme) replace;

display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*1;

xi3: xtpcse d.ln_total_transfers_cap i.prev97*pol soe_high49  d.secondary d.tel_1 d.gdp_cap d.urban_per distance_hcmchn  area_1 city brvt , correlation(psar1) hetonly;
outreg2 using "C:\data\Split\trans_Jan08";

display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*1;

generate sal_grow=(d.salary_gov2/l.salary_gov2)*100;

xi3: xtpcse sal_grow  i.prev97*pol  soe_high49  d.secondary d.tel_1 d.gdp_cap d.urban_per distance_hcmchn  area_1 city_dum brvt, correlation(psar1) hetonly;
outreg2 using "C:\data\Split\trans_Jan08";

display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*1;


xi3: xtpcse ln_stateinv_cap  i.prev97*pol soe_high49  d.secondary d.tel_1 d.gdp_cap d.urban_per distance_hcmchn  area_1 city_dum brvt, correlation(psar1) hetonly;
outreg2 using "C:\data\Split\trans_Jan08", e(rsme) label excel;

display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*0+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*0+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*0;
display _b[_cons]+_b[brvt_dum]*0+_b[city]*0+_b[area_1]*5.22+_b[distance_h]*245.47+_b[d.urban_per]*.379+_b[d.gdp_cap]*.370+_b[d.tel_1]*6.83+_b[d.secondary]*.0005+_b[soe_high49]*.46+_b[pol]*1+_b[ _Iprev97_1]*1+_b[  _Ipr1Xpo]*1;



save "Gerry0921",replace;


clear;

use province_numbers;

twoway (tsline nonstate, lpattern(solid)) (tsline state, lpattern(longdash)) (scatter line separation, msize(medlarge) msymbol(diamond) mcolor(purple)), 
ytitle(Number of Provinces, size(medium)) ylabel(16 (2) 42, labels valuelabel labsize(vsmall)) tlabel(1990(1)2004, labsize(small)) 
legend( rows(2) label(1 Number of Non-State Provinces) label(2 Number of State Sector Provinces)) 
title(Change in Composition of Vietnamese Provinces, size(medium)) 
legend (rows(3) label(1 Non-State Dominant Provinces) 
label(2 State-Sector Dominant Provinces) label(3 Year of Provincial Separation) size(small)) fysize(125);

graph save "C:\data\Split\number.gph", replace;

tsline  state_gdp, lpattern(solid) lwidth(medthick) lcolor(green)  ytitle(%, size(medium)) xlabel(1990 (1) 2004, labels valuelabel labsize(small))  
ylabel( 32 (2) 42, labels valuelabel labsize(vsmall)) title(State Sector Share of National GDP, size(medium)) fysize(55);

graph save "C:\data\Split\gdp.gph", replace;

gr combine gdp.gph number.gph , col(1) xcommon imargin(vsmall);
graph save "C:\data\Split\combine.gph", replace

clear;

use "C:\data\Split\PredictedProb.dta";

twoway (rcap high low year if type2==2, lpattern(--))  (rcap high low year if type2==1,  lwidth(thick) ) 
(scatter probability year, mlabel(probability) mlabsize(small) mlabcolor (black) msize(medlarge) mcolor(purple)), 
ytitle (Predicted Probability) xtitle( . , size(zero)) xlabel( 1990 (1) 2003, labsize(vsmall)) 
legend (rows (3) label (1 95% Confidence Interval for Non-State Provinces ) label (2 95% Confidence Interval for SOE-Dominant Provinces) 
label (3 Predicted Probability of Separation (Table 3  - Model 14)) size(small) note(Implemented using Clarify (King, Tomz,and Wittenberg 2000). 
Provinces are assumed to be previously unsplit and not yet at 1965 borders.  All other variables held to mean, size(tiny)));

graph save "C:\data\Split\ci.gph", replace;




log close;














